package com.company;

import lombok.ToString;
import lombok.experimental.SuperBuilder;

/**
 * 写代码测试，有继承关系的实体类使用lombok注解@ToString的注意事项
 * @date : 2024-02-23 下午2:17
 */

public class P069_LombokToString {

    @SuperBuilder
    @ToString
    public abstract static class Person {

        private String name;
    }

    @SuperBuilder
    @ToString
    public static class Student extends Person {

        private String studentId;

    }

    @SuperBuilder
    @ToString(callSuper = true)
    public static class Worker extends Person {

        private String workerId;

    }


    public static void main(String[] args) {
        Worker worker = Worker.builder()
                .workerId("123")
                .name("张三")
                .build();
        System.out.println(worker);

        Student student = Student.builder()
                .studentId("798")
                .name("李四")
                .build();
        System.out.println(student);

    }

}
